<div id="butt_back">
    <%= link_to image_tag("/images/b_back_report_management.gif", :border=>0), :action => 'completed' %>
</div>

<%= render :partial => "browse_requests", :locals => {:report_request => @report_request, :action => 'admin_view_completed_report'} %>

<div id="tabs_reports">
	<ul>
		<li></li>
		<li class="on"><span><%= _('Report') %></span></li>
		<li class="off"><%= link_to "<span>Completeness</span>", :action => 'admin_view_completed_completeness', :id => @report_request.id %></li>
	</ul>
</div>
		
<div class="clear"></div>

<div id="maintable">
	<table cellspacing="0" cellpadding="0" class="admin_table_report">
		<col id="col1"/><col id="col2"/><col id="col3"/><col id="col4"/><col id="col5"/><col id="col6"/><col id="col7"/><col id="col8"/><col id="col9"/><col id="col10"/><col id="col11"/>
		<tbody>
			<tr>
				<th class="col1"><%= _('XB') %></th>
        		<th class="col2"><%= _('XB Site Location') %></th>
            	<th class="col3"><%= _('Status') %></th>
            	<th class="col4"><%= _('Yr Started') %></th>
				<% @groupings.each do |g| %>
            		<th class="col5"><%= g.tab_name %><br/><%= g.strategy.short_name %></th>
				<% end %>
            </tr>
			<% @responses.each do |crossborder, report_responses| %>
				<% report_responses.each do | report_response| %>
					<% site = report_response.owner_role.site %>
		        	<tr>
			            <td class="col1"><%= site.cross_borders.map(&:number).join(', ') %></td>
			            <td class="col2"><%= site.name %> - <%= site.matching_names %></td>
			            <td class="col3">
			            	<% if report_response.is_submitted %>
			            		<img src="/images/circ_y.gif" />
							<% else %>
								<img src="/images/circ_n.gif" />
							<% end %>
			            </td>
			            <td class="col4"><%= report_response.created_at.year %></td>
						<% i = 5 %>
						<% @groupings.each do |group| %>
						 	<td class="col<%=i%>">
								<% group.questions_for_role(report_response.owner_role).each do |question| %>
									<% if question.is_yes_no %>
										<% if report_response.answer(question).is_yes%>
			            					<img src="/images/circ_y.gif" />
										<% else %>
											<img src="/images/circ_n.gif" />
										<% end %>
									<% end rescue nil %>
								<% end %>
							</td>
							<% i+=1 %>
						<% end %>
			        </tr>
	        	<% end %>
        	<% end %>
		</tbody>
	</table>
</div><!--/maintable-->
